package gbackup.command;

import gbackup.core.Shell;

public class LocalMakeDirectoryCommand extends Command {

	public LocalMakeDirectoryCommand(Shell shell, String rawCommand) {
		super(shell, rawCommand);
	}

	@Override
	public void execute() {
		if(this._arguments.size() != 1) {
			this._outputPrintStream.println("Invalid Argument : [" + this._rawCommand + "]");
			return;
		}
		
		String targetDirectoryPath = this._arguments.get(0);
		
		java.io.File targetDirectory = new java.io.File(this._shell.getLocalWorkingDirectory().getAbsolutePath() + java.io.File.separator + targetDirectoryPath);
		if(targetDirectory.exists()) {
			this._outputPrintStream.println("Directory already exist : [" + targetDirectory + "]");
			return;
		}
		targetDirectory.mkdir();
	}

}
